package com.chf.carsystem.users.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.Iterator;

/**
 * 用户类
 * @author chf
 *
 */
public class User implements Serializable{


	private int id;
	private String name;
	private String identity;
	private String truename;
	private byte sex;
	private String address;
	private String phone;
	private int roleId;
	private String password;
	private int loginCount;
	private String lastLoginIp;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date lastLoginTime;
	
	//关联的属性
	private Role role;
	
	//状态的str属性
	private String statusStr;

	
	
	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIdentity() {
		return identity;
	}

	public void setIdentity(String identity) {
		this.identity = identity;
	}

	public String getTruename() {
		return truename;
	}

	public void setTruename(String truename) {
		this.truename = truename;
	}

	public byte getSex() {
		return sex;
	}

	public void setSex(byte sex) {
		this.sex = sex;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getLoginCount() {
		return loginCount;
	}

	public void setLoginCount(int loginCount) {
		this.loginCount = loginCount;
	}

	public String getLastLoginIp() {
		return lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	public byte getStatus() {
		return status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getStatusStr() {
		MyEnum[] myEnums = MyEnum.values();
		for (int i = 0; i < myEnums.length; i++) {
			MyEnum myEnum = myEnums[i];
			if(this.status == myEnum.getStatus() && myEnum.toString().startsWith("USERSTATUS_"))
			{
				this.statusStr = myEnum.getInfo();
			}
		}
		return statusStr;
	}

	public void setStatusStr(String statusStr) {
		
		this.statusStr = statusStr;
	}
	
	

}
